package flags

import (
	"gitee.com/lvshicong/blog/global"
	"gitee.com/lvshicong/blog/models"
	"github.com/sirupsen/logrus"
)

func FlageDB() {
	err := global.DB.AutoMigrate(
		&models.UserModel{},
		&models.UserConfModel{},
		&models.ArticleModel{},
		&models.CategoryModel{},
		&models.ArticleDiggModel{},
		&models.CollectModel{},
		&models.UserArticleCollectModel{},
		&models.UserArticleLookHistoryModel{},
		&models.CommentModel{},
		&models.BannerModel{},
		&models.LogModel{},
		//用户登录表
		&models.UserLoginModel{},
		//全局通知表
		&models.GlobalNotificationModel{},
	)
	if err != nil {
		logrus.Errorf("数据库迁移失败: %s \n", err)
	}
	logrus.Infoln("数据库迁移成功")
}
